package com.cloudwise.pollux.user.rpc;

import com.cloudwise.pollux.common.constants.ServiceConstants;
import com.cloudwise.pollux.common.request.PlaceOrderRequest;
import com.cloudwise.pollux.common.response.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Order服务接口
 * @author sky
 * @date 2020-02-02
 */
@FeignClient(value = ServiceConstants.ORDER_SERVICE,fallback = OrderCallback.class)
public interface OrderInterface {
    /**
     * 下单接口
     * @param placeOrderRequest 下单请求
     * @return 统一响应
     */
    @PostMapping(value = "/order/placeOrder",consumes = MediaType.APPLICATION_JSON_VALUE)
    Response placeOrder(@RequestBody PlaceOrderRequest placeOrderRequest);

    /**
     * 取消订单接口
     * @param orderId 订单号
     * @return 统一响应
     */
    @PostMapping(value = "/order/placeOrder",consumes = MediaType.APPLICATION_JSON_VALUE)
    Response cancleOrder(@RequestParam("orderId") String orderId);
}
